﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Castle.MicroKernel.Lifestyle;

namespace DIBestPractice.Application
{
    class Program
    {
        static void Main(string[] args)
        {
            var container = ApplicationBootstrap.RegisterComponents();
            using (container.BeginScope())
            {
                var userManager = container.Resolve<UserManager>();
                userManager.RegisterUser("tom", "tom@qq.com", 20);
                userManager.RegisterUser("jim", "jim@qq.com", 20);
                userManager.RegisterUser("jack", "jack@qq.com", 20);

                var users = userManager.GetAllUsers();
                users.ForEach(x => Console.WriteLine(x.Name + "-" + x.Email + "-" + x.Age));

                container.Release(userManager);
            }

            Console.ReadLine();
        }
    }
}
